home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / pgm_util / mediaid / mediaid.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-06-25  |  2.8 KB  |  89 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Get MEDIA ID (Serial Number, Volume Label, ...)"
  5.    ClientHeight    =   6030
  6.    ClientLeft      =   945
  7.    ClientTop       =   1365
  8.    ClientWidth     =   6765
  9.    FontBold        =   0   'False
  10.    FontItalic      =   0   'False
  11.    FontName        =   "MS Sans Serif"
  12.    FontSize        =   8.25
  13.    FontStrikethru  =   0   'False
  14.    FontUnderline   =   0   'False
  15.    Height          =   6375
  16.    Left            =   915
  17.    LinkTopic       =   "Form1"
  18.    ScaleHeight     =   6030
  19.    ScaleWidth      =   6765
  20.    Top             =   1050
  21.    Width           =   6825
  22.    Begin ListBox List2 
  23.       Height          =   225
  24.       Left            =   90
  25.       TabIndex        =   1
  26.       Top             =   540
  27.       Width           =   6585
  28.    End
  29.    Begin SSPanel Panel3D2 
  30.       AutoSize        =   3  'AutoSize Child To Panel
  31.       BevelOuter      =   1  'Inset
  32.       Height          =   5130
  33.       Left            =   90
  34.       TabIndex        =   4
  35.       Top             =   810
  36.       Width           =   6585
  37.       Begin ListBox List1 
  38.          Height          =   5100
  39.          Left            =   15
  40.          TabIndex        =   2
  41.          Top             =   15
  42.          Width           =   6555
  43.       End
  44.    End
  45.    Begin SSPanel Panel3D1 
  46.       AutoSize        =   3  'AutoSize Child To Panel
  47.       BevelOuter      =   1  'Inset
  48.       Height          =   375
  49.       Left            =   90
  50.       TabIndex        =   3
  51.       Top             =   90
  52.       Width           =   1725
  53.       Begin CommandButton Command1 
  54.          Caption         =   "&Get Media ID"
  55.          Height          =   345
  56.          Left            =   15
  57.          TabIndex        =   0
  58.          Top             =   15
  59.          Width           =   1695
  60.       End
  61.    End
  62. Option Explicit
  63. Sub Command1_Click ()
  64.    Dim i       As Integer
  65.    Dim status  As Integer
  66.    Dim disk    As String
  67.    Dim MEDIAID As tagMEDIAID
  68.    ' clear all list boxes
  69.    List1.Clear
  70.    List2.Clear
  71.    ' add title
  72.    List2.AddItem "Disk" & Chr$(9) & "Serial Number" & Chr$(9) & "Volume Label" & Chr$(9) & "FAT type"
  73.    ' process all disks 'A' - 'Z'
  74.    For i = 1 To 26
  75.       ' get drive letter
  76.       disk = Chr$(64 + i)
  77.       ' get the media ID
  78.       status = cDOSGetMediaID(disk, MEDIAID)
  79.       ' check if the media ID exist
  80.       If (status = True) Then
  81.          ' yes, add it in the list
  82.          List1.AddItem Chr$(64 + i) & Chr$(9) & Right$("00000000" + Hex$(MEDIAID.SerialNumber), 8) & Chr$(9) & MEDIAID.VolLabel & Chr$(9) & MEDIAID.FileSysType
  83.       Else
  84.          ' no, add 'no media id'
  85.          List1.AddItem disk & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & "no media id"
  86.       End If
  87.    Next i
  88. End Sub
  89.